package com.bjc.principle.composite;

/**
 * @program: DesignPattern
 * @description: 组合模式
 * @author: bjc
 * @create: 2021-01-04 17:22
 */
public class CompositePattern {
    public static void main(String[] args) {
        Composite china = new Composite();
        china.add(new City(1000)); //直辖市-北京
        china.add(new City(2000));  //直辖市-上海

        Composite anHui = new Composite();
        anHui.add(new City(3000)); //合肥市
        anHui.add(new City(3000));  //马鞍山市

        china.add(anHui);
        System.out.println(china.count());
    }
}
